
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">跳转链接:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="link-name" class="form-control" name="link[name]" type="text" {notempty name="$row.link" }value="{$row['link']['name']}" {/notempty}>
                <input id="link-open_type" type="hidden" name="link[open_type]" {notempty name="$row.link" }value="{$row.link['open_type']}" {/notempty}>
                <input id="link-url" type="hidden" name="link[url]" {notempty name="$row.link" }value="{$row.link['url']}" {/notempty}>
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="linkBtn" class="btn btn-default" onclick="link()">选择链接</button></span>
                </div>
            </div>
        </div>
    </div>

    <div id="link-params">
        {notempty name="$row.link" }
            {notempty name="$row.link['params']" }
                {foreach $row.link['params'] as $k=>$vo}
                    <div class="form-group">
                        <label class="control-label col-xs-12 col-sm-2">{$row.link['desc'][$k]}:</label>
                        <div class="col-xs-12 col-sm-8">
                            <input class="form-control" name="link[params][{$k}]" type="text" value="{$vo}">
                            <input type="hidden" name="link[desc][{$k}]" value="{$row.link['desc'][$k]}">
                        </div>
                    </div>
                {/foreach}
            {/notempty}
        {/notempty}
    </div>

<script>
    function link() {
        Fast.api.open('kzvote.link/index','选择链接', {
            callback:function(data){
                data = eval('(' + data + ')');
                if(data){
                    $("#link-namel,#link-open_type,#link-url").val('')
                    $("#link-params").html('')
                }
                $("#link-name").val(data.name)
                $("#link-open_type").val(data.open_type)
                $("#link-url").val(data.url)
                if(data.params){
                    let params = data.params
                    for (var i in params){
                        let html = '<div class="form-group"><label class="control-label col-xs-12 col-sm-2">'+params[i].desc;
                        html += '</label><div class="col-xs-12 col-sm-8">';
                        html += '<input class="form-control" name="link[params]['+params[i].key+']" type="text">';
                        html += '<input type="hidden" name="link[desc]['+params[i].key+']" value="'+params[i].desc+'">';
                        html += '</div></div>';
                        $("#link-params").append(html)
                    }
                }
            }
        })
    }
</script>